/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.wechat.entity.book;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.boxin.ims.modules.wechat.entity.dic.Storefront;
import com.boxin.ims.modules.wechat.entity.dic.TimeQuantum;
import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 预定服务Entity
 * @author Jakemanse
 * @version 2013-12-08
 */
@Entity
@Table(name = "wp_book_order")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class BookOrder extends BaseEntity {
	public static final String STATUS_FREE = "0";	//空闲
	public static final String STATUS_ORDER = "1";	//预订
	public static final String STATUS_USING = "2";	//使用中
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private Storefront storefront;	//所属于店
	private String name; 	// 预定服务名称
	private String price;	//价格
	private String timeFlag;		//是否有时间段选择  0：元  1：有
	private Integer validHours;		//有效时间小时
	private Integer validDays;		//有效时间天数
	private Integer freeAmount;	//当前空闲数量
	private String status;				//0：空闲  1:预定  2：使用中
	private String remarks;	//描述
	private Date createTime;	// 创建日期

	public BookOrder() {
		this.status = "0";
		this.timeFlag = NO;
		this.createTime = new Date();
	}

	public BookOrder(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_book_bookOrder")
	//@SequenceGenerator(name = "seq_wechat_book_bookOrder", sequenceName = "seq_wechat_book_bookOrder")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}



	public Integer getFreeAmount() {
		return freeAmount;
	}

	public void setFreeAmount(Integer freeAmount) {
		this.freeAmount = freeAmount;
	}



	public Integer getValidHours() {
		return validHours;
	}

	public void setValidHours(Integer validHours) {
		this.validHours = validHours;
	}

	public Integer getValidDays() {
		return validDays;
	}

	public void setValidDays(Integer validDays) {
		this.validDays = validDays;
	}

	

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@ManyToOne
	@JoinColumn(name="storefront_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Storefront getStorefront() {
		return storefront;
	}

	public void setStorefront(Storefront storefront) {
		this.storefront = storefront;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getTimeFlag() {
		return (timeFlag==null || timeFlag.trim().length()==0) ? NO:YES;
	}

	public void setTimeFlag(String timeFlag) {
		this.timeFlag = timeFlag;
	}
	
	
	
	
	
	
	

	
}


